# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=openbgpd
pkgver=8.6
pkgrel=0
pkgdesc="Free implementation of the Border Gateway Protocol, Version 4"
url="https://www.openbgpd.org"
arch="all"
license="ISC"
makedepends="libevent-dev"
subpackages="$pkgname-dbg $pkgname-doc $pkgname-openrc"
source="https://cdn.openbsd.org/pub/OpenBSD/OpenBGPD/openbgpd-$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make -k check
}

package() {
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m755 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
1dce01a7c9939f2097f6cc5cebaa6a9c9531bb244d93c22457bc0d8438412c277e9c4a1ddda4580394b8e88dda6856838dac1e8c4e855f58a73b4ca062800672  openbgpd-8.6.tar.gz
0e9f2f3590c5315ea4902aa62f15fdfdb3147a87db7a27a3f66b55d3a5d739243583b188ef7616ac4f9adf4fe4402e24fc547ea023905527f6ef4ac10ed1c3db  openbgpd.initd
eb1bc5a62d178b7909509a17d939583750a192dd37884d8303deae0ac289a526eaaead9138561fe120bfd2a1c4ddfff4618b5defb0b35601e61ae2f9015d5d6b  openbgpd.confd
"
